import Vue from 'vue'
import VueRouter from 'vue-router'
// import store from '../store/index'

Vue.use(VueRouter)

const routes = [
  { path: '/login', name: 'login', meta:{ title: '登录页面' }, component: () => import('../views/VueLogin.vue')},
  { path: '/', name: 'home', meta:{ title: '主页面', auth: true }, component: () => import('../views/HomeView.vue'),
    children:[
      // { path: 'examine', name: 'examine', meta:{ title: '审核管理', auth: true }, component: () => import('../components/WXS/VuePaste.vue')},
      // { path: 'examine', name: 'examine', meta:{ title: '审核管理', auth: true }, component: () => import('../components/WXS/VuePasteDetail.vue')},
      { path: 'examine', name: 'examine', meta:{ title: '审核管理', auth: true }, component: () => import('../components/WXS/VuePasteDetailNot.vue')},
      { path: 'SigningFee', name: 'SigningFee', meta:{ title: '广告签约管理-签约金结算', auth: true }, component: () => import('../components/WXS/VueSigningFee.vue')},
      // { path: 'examine', name: 'examine', meta:{ title: '审核管理', auth: true }, component: () => import('../components/WXS/VueSigningFeeAready.vue')},
      { path: 'VueSigningFeeNot', name: 'VueSigningFeeNot', meta:{ title: '广告签约管理-签约金结算-详情（未结算情况）', auth: true }, component: () => import('../components/WXS/VueSigningFeeNot.vue')},
    ]
  }
]

const router = new VueRouter({
  routes
})


//路由前置守卫
// router.beforeEach((to,from,next)=>{
//   const meta = to.meta
//   const { title, auth } = meta
//   window.document.title = title;   //动态设置title
//   const token = store.state.token;
//   if(auth){
//     if(token){
//       next();
//     }else{
//       next({path: '/login'});
//     }
//   }else{
//     next();
//   }
// })

export default router
